﻿//********************************************************************
// 
//  file:  frmSummaryInfo.cs
// 
//  (C) Copyright 2010, Diomede Corporation
//  All rights reserved
// 
//  Use, modification, and distribution is subject to   
//  the New BSD License (See accompanying file license.txt).
// 
//********************************************************************

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using data.diomedestorage.com;
using Diomede.SDK;

namespace Diomede.Explorer
{
    public partial class frmSummaryInfo : Form
    {
        public frmSummaryInfo()
        {
            InitializeComponent();
        }

        public frmSummaryInfo(SearchFilesTotalInfo info, string title)
        {
            InitializeComponent();
            txtInfo.Clear();
            txtInfo.AppendText(title + "\r\n");
            txtInfo.AppendText(string.Format("As of {0}\r\n\r\n", info.createdDate.ToString()));
            txtInfo.AppendText(string.Format("{0} file(s)\t\t{1} byte(s)", info.fileCount, info.fileBytes));
            txtInfo.AppendText(string.Format("\r\n{0} deleted file(s)\t{1} byte(s)", info.deletedFileCount, info.deletedFileBytes));
            txtInfo.AppendText(string.Format("\r\n{0} upload(s)\t{1} byte(s)", info.uploadCount, info.uploadBytes));
            txtInfo.AppendText(string.Format("\r\n{0} download(s)\t{1} byte(s)", info.downloadCount, info.downloadBytes));
            txtInfo.AppendText("\r\n");
            foreach (var item in info.storageTotalInfo)
            {
                txtInfo.AppendText(string.Format("\r\nStorage Type {0}", item.storageTypeID));
                txtInfo.AppendText(string.Format("\r\n{0} file(s)\t\t{1} byte(s)", item.fileCount, item.fileBytes));
                txtInfo.AppendText(string.Format("\r\n{0} microwatts", item.power));
                txtInfo.AppendText("\r\n");
            }

        }

        public frmSummaryInfo(SearchFilesTotalInfo[] infos, string title)
        {
            InitializeComponent();
            txtInfo.Clear();
            txtInfo.AppendText(title + "\r\n");

            foreach (var info in infos)
            {
                txtInfo.AppendText(string.Format("As of {0}\r\n\r\n", info.createdDate.ToString()));
                txtInfo.AppendText(string.Format("{0} file(s)\t\t{1} byte(s)", info.fileCount, info.fileBytes));
                txtInfo.AppendText(string.Format("\r\n{0} deleted file(s)\t{1} byte(s)", info.deletedFileCount, info.deletedFileBytes));
                txtInfo.AppendText(string.Format("\r\n{0} upload(s)\t{1} byte(s)", info.uploadCount, info.uploadBytes));
                txtInfo.AppendText(string.Format("\r\n{0} download(s)\t{1} byte(s)", info.downloadCount, info.downloadBytes));
                txtInfo.AppendText("\r\n");
                foreach (var item in info.storageTotalInfo)
                {
                    txtInfo.AppendText(string.Format("\r\nStorage Type {0}", item.storageTypeID));
                    txtInfo.AppendText(string.Format("\r\n{0} file(s)\t\t{1} byte(s)", item.fileCount, item.fileBytes));
                    txtInfo.AppendText(string.Format("\r\n{0} Power", item.power));
                    txtInfo.AppendText("\r\n");
                }
                txtInfo.AppendText("\r\n-----------------------------------------------------------");
                txtInfo.AppendText("\r\n\r\n");
            }
        }


        public frmSummaryInfo(ISearchFilesSummaryResult info)
        {
            InitializeComponent();
            txtInfo.Clear();
            
        }

        private void frmSummaryInfo_Load(object sender, EventArgs e)
        {

        }
    }
}
